-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Technical review: Document interest invokers #42021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Preview URLs (28 pages)
Flaws (183)Note! 15 documents with no flaws that don't need to be listed. 🎉 URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
External URLs (1)URL:
(comment last updated: 2025-11-22 14:59:08) |
mfreed7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM! This looks great to me, thanks for putting it together. I left some comments, but all of them are fairly small.
| - : A string that is the result of parsing the [`href`](/en-US/docs/Web/HTML/Reference/Elements/a#href) HTML attribute relative to the document, containing a valid URL of a linked resource. | ||
| - {{domxref("HTMLAnchorElement.hreflang")}} | ||
| - : A string that reflects the [`hreflang`](/en-US/docs/Web/HTML/Reference/Elements/a#hreflang) HTML attribute, indicating the language of the linked resource. | ||
| - {{domxref("HTMLAnchorElement.interestForElement")}} {{experimental_inline}} {{ReadOnlyInline}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interestForElement shouldn't be marked readonly - it can be written also, just like all other element reference reflections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is a good call. I've removed those macro calls and updated the description appropriately.
I've also changed the examples on the interestForElement ref pages and the basic API example in the guide to use interestForElement to set up the invoker/target relationship rather than the interestFor attribute, as I think it's important to make it clear that you can set up the relationship programmatically as well as declaratively.
| </p> | ||
| <p id="mytooltip" popover="hint">A hover toolip</p> | ||
| <p id="myinfobox" popover> | ||
| An infobox that also contains some control buttons<br /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just <br> without the xhtml trailing slash. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love it if we were able to get rid of XHTML trailing slashes on MDN, but unfortunately, we lint all the markup with prettier, which enforces them 😢
|
|
||
| {{embedlivesample("interest-invoker-styling", "100%", "150")}} | ||
|
|
||
| Try showing interest in the button (for example by hovering or focusing it) to observe the behavior described earlier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere, perhaps right here, it might be interesting to add a common use case:
container:has(:interest-source) {
interest-show-delay: 0s;
}I.e. when you've already shown interest in something (within a container of some sort), remove the show delay on subsequent elements, so that you can quickly move between them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, I think this needs a bit more explanation. I understand the logic of what you are saying, but I can't seem to get this to work. after I've pushed my next commit, the updated code should be available at https://pr42021.review.mdn.allizom.net/en-US/docs/Web/API/Popover_API/Interest_invokers#styling_interest_invokers. Have a look and let me know what I am doing wrong ;-)
|
|
||
| ### Result | ||
|
|
||
| This renders as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool demo!
| {{embedlivesample("link-preview-popover", "100%", "260", , , , , "allow-popups")}} | ||
|
|
||
| Try hovering/focusing the link to show the preview popover. There is also progressive enhancement at play in this example — in non-supporting browsers, the link will still work as expected. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall - very nice overview page for the API. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, glad you like it!
|
|
||
| The **`interest`** event of the {{domxref("HTMLElement")}} interface is fired on an [interest invoker](/en-US/docs/Web/API/Popover_API/Interest_invokers)'s target element when interest is shown, allowing code to be run in response. | ||
|
|
||
| This event is not [cancelable](/en-US/docs/Web/API/Event/cancelable). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interest event is always cancelable. The loseinterest event is usually cancelable, except in a few cases, such as when the user hits the ESC key to lose interest in everything in the document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, gotcha. I've updated both pages as appropriate.
|
|
||
| ## Formal definition | ||
|
|
||
| {{CSSInfo}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that these are broken, at least in the preview. Probably just a preview issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think this info needs to be added. I'll look into it.
|
|
||
| {{SeeCompatTable}} | ||
|
|
||
| The **`interest-delay-start`** [CSS](/en-US/docs/Web/CSS) property specifies a delay between the user showing interest in an [interest invoker](/en-US/docs/Web/API/Popover_API/Interest_invokers) element and the target element effect starting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a personal nit, but "target element effect starting" sounds a bit vague. Do you want to say something like "and the interest event being fired, which typically starts an effect on the target" ? Or just the first part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this wording; updated on all the property pages.
Description
Chrome 142 adds support for interest invokers: see https://chromestatus.com/feature/4530756656562176.
This PR aims to document all features of interest invokers. Specifically, it will add:
interestforattribute, which is available on the<a>,<button>,<area>, and SVG<a>elements.:interest-sourcepseudo-class.:interest-targetpseudo-class.interest-delay,interest-delay-start, andinterest-delay-endproperties.interestForElementproperty, which is available on theHTMLButtonElement,HTMLAnchorElement,HTMLAreaElement, andSVGAElementinterfaces.interestandloseinterestevents, which are fired on theHTMLElementinterface.InterestEventinterface.Motivation
Additional details
Related issues and pull requests